package com.example.orderservice.controller;

import com.example.orderservice.api.ProductApi;
import com.example.productapi.model.ProductInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign")
public class FeignController {
    @Autowired
    private ProductApi productApi;

    @RequestMapping("/o1")
    public String p1(Integer id) {
        return productApi.p1(id);
    }


    @RequestMapping("/o2")
    public String p2(Integer id, String name) {
        return productApi.p2(id, name);
    }

    @RequestMapping("/o3")
    public String p3() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(100);
        productInfo.setProductName("Feign 测试商品 o3");
        return productApi.p3(productInfo);
    }

    @RequestMapping("/o4")
    public String p4() {
        ProductInfo productInfo = new ProductInfo();
        productInfo.setId(10);
        productInfo.setProductName("Feign 测试商品 o4");
        return productApi.p4(productInfo);
    }

}
